\section{Rings and Modules}
Rings: Definitions, Examples (Fraenkel, 1914)

\begin{Definition}[Ring]
A ring $(R,+,\cd,1)$ is a set $R$ such that 

\begin{itemize}
	\item  $(R,+)$ is an abelian group,
	\item $(R,\cd)$ is a monoid and
	\item $\cd$ is distributive with $+$.
	
	\begin{itemize}
		\item $a\cd (b+c)=a\cd b + a \cd c$ (left distributive)
		\item $(b+c)\cd a=b\cd a + c \cd a$ (right distributive)
	\end{itemize}
\end{itemize}

Call $R$ comutative if its monid multiplication is commutative.
\end{Definition}

\begin{Example}

\begin{itemize}
	\item $\{0=1\}$
	\item $\ZZ$, $\ZZ / m$, $M_n(K)$.
	\item Linear endomorphism ring $End(V)$ of a vector space $V$.
	\item Endomorphism ring $End(A)$ of an abelian group $A$.
	\item Given a ring $R$, you can form:

\begin{itemize}
	\item a matrix  ring $M_n(R)$,
	\item polynomial ring $R[t]$,
	\item Laurent polynomial ring $R[t,t^{-1}]$,
	\item  power series ring $R[[t]]$,
	\item $R(t)$ rational functions / rational polynomials (ratios of polynomials),
	\item ring of functions (continuous if there exists a topology) $Map(X,R)$, where $X$ is a set,
	\item ring of continuous  complex functions $\CCC(X)$, $X$ a topological space.
\end{itemize}
\end{itemize}
\end{Example}

\begin{Lemma}
In any ring $R$, for all $r\in R$ we have 

\begin{itemize}
	\item $r \cd 0 = 0 = 0 \cd r$.
	\item $r \cd (-1)= -r = (-1)\cd r$
\end{itemize}
\end{Lemma}

\begin{Definition}[nonunital]
If in defining a ring we do not require the existence of the multiplicative identity, then we obtain a nonuital ring (or pseudoring).
\end{Definition}

EG: Nonuital ring of even integers $2\ZZ$.
\begin{Definition}
$S\subset R$ is a subring of $(R,+,\cd,1)$ if $(S,+,\cd,1)$ is a ring.
\end{Definition}

\begin{Example}
For any ring $R$ the centre $Z(R)=\{r\in R : \forall x\in R~ rx=xr\}$ is a subring.

Question: What is $Z(M_n(R))$?

On the other hand, $M_n(R) \subset M_{n+1}(R)$ if you send 
$A\rightarrow 
\begin{pmatrix}
	A & 0 \\
	0 & 0
\end{pmatrix}$
is not a subring, since $I_n \not \mapsto I_{n+1}$ (It's a subnonunital ring)
\end{Example}

\begin{Definition}[Ideal, Principle Ideal]
For any ring $(R,+,\cd,1)$ let $(I,+)$ be a subgroup of $(R,+)$. Then $I$ is a left ideal if $\forall r\in R, x \in I$
$r x \in I$ (or $R\cd I =I$), a right ideal if $I\cd R= I$, and a two sided ideal if it is a left and right ideal.

When $R$ is commutative, these definitions coincide.

An ideal $I$ is called principal, with generator $x$  if $I$ is the smallest ideal that contains $x$. This means that every element of $I$ is of form $rx+xr'$ for some $r,r' \in R$.
\end{Definition}


Exists principal left ideal $Rx$ and pricipial right ideal $xR$. In two sided case can write $R(x)$.

\begin{Example}
\begin{enumerate}
\item $m\ZZ$ is an ideal of $\ZZ$. 
\item In Fact every ideal of $\ZZ$ is principal; $\ZZ$ is a principal ideal ring. This uses the Euclidean algorithm. Generalizing gives: 
Euclidean Ring $\Rightarrow$ principal ideal ring.
\item
$
\begin{pmatrix}
	R & 0 \\
	R & 0
\end{pmatrix} $ is a left ideal of $M_2(R)$
\item
$
\begin{pmatrix}
	R & R \\
	0 & 0
\end{pmatrix} $ is a right ideal of $M_2(R)$
\end{enumerate}
Questions: What are the ideals of $M_2(R)$?
\end{Example}
\begin{Definition}[ring homomorphism]
Let $R,S$ be rings. $f:R\rightarrow S$ is ca ring homomorphism if it is both an addition group homomorphism and a multiplication monoid homomorphism, i.e.

\begin{itemize}
	\item  $f(r_1,+r_2)=f(r_1)+f(r_2)$
	\item $f(r_1\cd r_2)=f(r_1)\cd f(r_2)$
	\item $f(1_R)=1_S$
\end{itemize}
Without this last condition, $f$ is a nonuital ring homomorphism.

\end{Definition}

\begin{Example}

\begin{itemize}
	\item If $R\subset S$ with $S$ a ring, then $R$ is a subring of $S$ iff the inclusion function $R \hookrightarrow S$ is a ring homomorphism.
	\item For all rings $S$ there exists the unique characteristic homomorphism \mbox{$\chi : \ZZ \rightarrow S$}.
	Since $\chi(1_{\ZZ})=1_S$ and $\chi$ is a homorphism of abelian groups and $\ZZ$ is the free abelian group on $1_{\ZZ}$, $\chi$ is uniquely defined.
\end{itemize}

\end{Example}

\begin{Definition}[isomorphism, kernel, image]
A ring homomorphism $f: R\rightarrow S$ is an isomorphism if it has an inverse function from $S\rightarrow R$ that is also a ring homomorphism.

For all ring homomorphisms $f: R \rightarrow S$, we can form its image \mbox{$Im(f)=\{f(r) : r\in R \}$} and its Kernel \mbox{$Ker(f)=\{r \in R : f(r)=0\}$} (after E. Noether, 1926), we define the residue ring $R/K=$quotient additive group $R/K$ with multiplication and $1_{R/K}$ inherited/induced by $R$.

\begin{itemize}
	\item $(r_1+K)\cd(r_2+K)=r_1\cd r_2 + K $
	\item $1_{R/K}=1_R + K$
\end{itemize}
Check (!) that this is a ring (e.g. distributivity $\Rightarrow$ well-defined, i.e. does not depend on the choice of coset representative).

\end{Definition}

\begin{Example}
Ideal $m\ZZ$ of $\ZZ$ gives the residue ring $\ZZ /m \ZZ$ of all integer reidues modulo $m$.
\end{Example}
\begin{Lemma}

\begin{itemize}
	\item Every ring homomorphism $f:R \rightarrow S$ has $Im (f)$ as a subring of $S$. Every subring of $S$ is the image of its inclusion.
	\item Every ring homomorphism $f: R\rightarrow S$ has its Kernel $Ker(f)$ as an ideal of $R$. Conversely, every ideal $K$ of $R$ is the kernel of a ring homomorphism with domain $R$ (actually $R\twoheadrightarrow R/K$)
	\item for all ideals $K$ of $R$ there exists bijections
	
	\begin{itemize}
		\item $\{\text{subrings $S$ of $R$ with } S\supset K \} \leftrightarrow \{\text{subrings of } R/K \}$
		\item $\{\text{ideals $I$ of $R$ that } I\supset K \} \leftrightarrow \{\text{ideals of }R/K \}$
	\end{itemize}
	
\end{itemize}

\end{Lemma}

\begin{Lemma}


Let $f: R\rightarrow S$ be a ring homomorphism

\begin{itemize}
	\item  The inclusion and quotient maps give a short exact sequence of nonunital ring homomorphisms
	$$0\rightarrow Ker(f)\rightarrow R \rightarrow Im(f) \rightarrow 0 $$
	\item (Induced mapping theorem) $f$ factorizes uniquely through $R/Ker f$; that is there exists exactly one 
	$\barf : R / Ker(f) \rightarrow S$ with 
	
	\factorizes{R}{R/Ker(f)}{S}{\mu}{f}{\exists ! \barf}
	
\end{itemize}

\end{Lemma}

\begin{Example}
Recall $\xi :  \ZZ\rightarrow S$.
$Im(\xi)$ is the prime subring $<1_S>$ of $S$. So by (2.3), $H$ must be a residue ring of $\ZZ$, i.e. of form $\ZZ /m\/$ for some $m\geq 0$. This $m$ is called the characteristic of $S$. For $m\geq 0$, it is the cardinality of $<1_S>$.

\end{Example}

\begin{Definition}
An element of $R$ is a unit if it has a two sided multiplicative inverse (neccessarily unique).

Under multiplication the units of $R$ form the unit group $U(R)$ (or $R^*$) of $R$.
Example: $U(M_n(R))=M_n(R)^*=GL_n(R)$.
\end{Definition}

\begin{Definition}
A ring $R$ is a division ring if $R^*=R-\{0\}$, and a field if it is also commutative.
\end{Definition}
\begin{Example}
The quaternions $\HH$ are a division ring that is not a field.

$\HH=\{a+b i_{\xi} + c j_{\xi} + d k_{\xi} | a,b,c,d\in\RR\}$

Question: What does this have to do with the quaternion group $Q_8$? 
\end{Example}

\begin{Definition}
A non-zero element of a ring $x\in R-\{0\}$ is a zero divisor if either there exists $a\in R-\{0\}$ with $ax=0$ or there exists $b\in R-\{0\}$ with $xb=0$.
\end{Definition}

\begin{Theorem}
Let $R$ be a ring. The following are equivlaent:

\begin{itemize}
	\item  $R$ is a subring of a field.
	\item $R$ is a commutative domain, i.e.
	
	\begin{itemize}
		\item $R$ is commutative and
		\item $R$ has no zero divisors.
	\end{itemize}
	
\end{itemize}

\end{Theorem}
\begin{Proof}
$b)\Rightarrow a)$

Let $\Sigma=R-\{0\}$.
For $a,a'\in R, s,s'\in \Sigma$, say
$(a,s)\sim (a',s')$ in $R\times \Sigma$ if there are $u,u'\in \Sigma$ such that
$au=a'u'$, $su=s'u'$

Question: Under what conditions on $R$ is this the same as the more obvious $as'=a's$?

Check that $\sim$ is an equivalence relation. The equivalence class of $(a,s)$ is written as $a/s$.
Check that the set $K$ of equivalence classes has the structure of a ring via

\begin{itemize}
	\item a/s+b/t=(at+bs)/(st)
	\item (a/s)(b/t)=(ab)/(st)
\end{itemize}
$K$ is commutative and we have:

\begin{itemize}
	\item  $R \hookrightarrow K$
	\item $a/s$ is the inverse of $s/a$
\end{itemize}
$K$ is a field.

$K$ is the field of fractions of $R$, more generally, we can invert any multiplicative set (monoid) $\Sigma$ of nonzero divisors of $R$, the annexed $R$

The process is called localisation,provided that $\Sigma$ satisfies an condition.
\end{Proof}
\begin{Example}
$\ZZ$ in $\QQ$.
\end{Example}

\subsection{Modules}
\begin{Definition}[right-module, left-module]
Fix a ring $R$ (not necessarily commutative). A right $R$-module is an (additive) abelian group $M$ together with a function 
$M\times R \rightarrow M$, $(m,x)\mapsto mx$
called the action of $R$ on $M$, satisfying
$\forall r,r_1,r_2,r_3\in R, m,m_1,m_2 \in M$

\begin{itemize}
	\item $(m_1+m_2)r=m_1r+m_2r$
	\item $m(r_1+r_2)=m_1r+m_2r$
	\item $m(r_1r_2)=(mr_1)r_2$
	\item $m1_R=m$
\end{itemize}
Sometimes write $M$ as $M_R$ to show that $R$ acts on the right of $M$.

Similarly for a left $R$-module and write ${}_R M$.
\end{Definition}
When $R$ is a field $F$, an $F$-module is the same as an $F$-vector space. The $F$-multiplication is called scalar multiplication.

\begin{Lemma}
In a right $R$-module $M$, $\forall r\in R, m\in M$ we have

\begin{itemize}
	\item  $m\cdot 0_R=0_M\cdot r$
	\item $m\cdot (-r)=-(mr)=(-m)\cdot r$
\end{itemize}

\end{Lemma}

\begin{Example}

\begin{itemize}
	\item The zero group $\{0\}$ is always an $R$-module via $0r=0$.
	\item When $R=\ZZ$, any abelian group $M$ (written additively) becomes a \mbox{$\ZZ$-module}.
	\item Given a ring $R$. Then $(R,+)$ is an abelian group and can be used to form an $R$-module.
	\begin{itemize} 
		\item Additively, $R$ is an abelian group. Its multiplication $R\times R\rightarrow R$ satisfies the axioms to make $R$ and $R$-module. We write this as $R_R$ or $R^R$
		\item Now let $I$ be a right ideal in $R$. Then $I$ is a right $R$-module.
		\item When $I$ is an ideal, make the ring $R/I$ a right $R$-module by $(r+I)s=rs+I$
		\item Now suppose that $R$ is a subring of a ring $S$. Since $(S,+)$ is an abelian group and $R$ acts on $S$ by the multiplication of $S$ then $S$ is an $R$-module. $R^S$ or $S_R$.
		\item For any rings $R$ and $S$, an $R$-$S$ bimodule ${}^R M^S$ is an additive group $M$ that is both a left $R$-module and a right $S$-module such that $r(ms)=(rm)s$.
	\end{itemize}
		
\end{itemize}

\end{Example}

\begin{Definition}[submodule]
Compare example (a) and (b) above to regard $I_R$ as a submodule of $R_R$.
In general, call a subset $M'$ of $M_R$ a submodule if:

\begin{itemize}
	\item  $M'$ is a subgroup of $M$ additively and
	\item if $m'\in M'$ and $r\in R$, then $m'r'\in M'$.
\end{itemize}

\end{Definition}

\begin{Example}

\begin{itemize}
	\item $F$ is a field. the $F$-submodules of the vector space $F^n$ are the subspaces.
	\item If $M$ is an abelian group regarded as a $\ZZ$-module, then its $\ZZ$-submodules are its subgroups.
	\item The $R$-submodules of $R^R$ are precisely the left ideals.
	\item Any module $M$ has both $M$ and $0$ as submodules.
\end{itemize}
\end{Example}

\begin{Lemma}
A nonempty subset $M'$ of $M_R$ is a submodule iff

\begin{itemize}
	\item  $m_1',m_2'\in M' \Rightarrow m_1'-m_2' \in M'$ and
	\item $m'\in M, r\in R \Rightarrow m'r\in M'$
\end{itemize}

\end{Lemma}
\begin{Lemma}
The intersection
 of any collection of submodules of $M_R$ is a submodule of $M_R$. 
\end{Lemma}
Let $\emptyset \neq X \subset M_R$. By Lemma 2.7, the intersection of all submodules of $M_R$ that contain $X$ is a submodule that also contains $X$, so it is the smallest such, called the submodule gereated by $X$.

Alternatively define
$X_R=\{\sum_{c=1}^n x_ir_i | x_i\in X, r_i\in R, n\in \NN\}$

\begin{Lemma}
$X_R$ is the submodule generated by $X$.
\end{Lemma}


THERE ARE SOME LECTURES MISSING IN HERE


\subsection{Module homomorphisms}
\begin{Definition}
A map $\phi: M_R\rightarrow N_R$ is an $R$-homomorphism if

\begin{itemize}
	\item  $\phi(m_1+m_2)=\phi(m_1)+\phi(m_2)$
	\item $\phi(m r)\phi(m)\cdot r$
\end{itemize}

\end{Definition}
\begin{Example}

\begin{itemize}
	\item $\forall$ submodules $M'\subset M$, the inclusion $M'\hookrightarrow M $ is an $R$-homomorphism 
	\item Dually $M \twoheadrightarrow M/M'$ is an $R$-homomorphism $m\mapsto m+M'$
	\item Zero map $0:M\rightarrow N$ is an $R$-homomorphism $m\mapsto 0$
\item Given $\phi,\psi:M\rightarrow N$, define $\phi+\psi:M\rightarrow N$ by $(\phi+\psi)(m)=\phi(m)+\psi(m)$. This gives an abelian group $Hom(M_R,N_R)$.
\item Also $\alpha:M_r\rightarrow N_R$, $\beta:N\rightarrow P$ compose to give $\beta\alpha: M_R\rightarrow P_R$ with $m\mapsto \beta(\alpha(m))$ forms a nonabelian group.
\item Whenever $M=N=P$, get $End(M_R)$ a ring under $+$ and the composition.Then $M_R$ becomes an $End(M_r)$-$R$-bimodule via $\phi (m r)=\phi(m)\cdot r$
\item For ${}_S M_R$, ${}_T N_R$,then $Hom(M_r,N_R)$ is a $T$-$S$-bimodule via $(t\phi s)(m)=t\cdot \phi(s m)$
\end{itemize}

\end{Example}
\begin{Definition}[kernel, image]
Given $\phi:M_R\rightarrow N_R$ we define \mbox{$Ker(\phi):=\{m\in M : \phi(m)=0\}\leq M$} and \mbox{$Im(\phi):=\{n\in N: \exists m\in M: \phi(m)=n\}\leq N$}.


\begin{itemize}
	\item $Ker (\phi)=0 \Leftrightarrow \phi$ monomorphism.
	\item $Im(\phi)=N \Leftrightarrow \phi$ epimorphism.
	\item $Ker (\phi)=0$ and $Im(\phi)=N$ $\Leftrightarrow$ $\phi$ is an isomorphism.
	\item If $M_R=N_R$ and $\phi$ is an isomorphism we call $\phi$ an automorphism.
	\item Given submodules $M'\leq M$, and $N'\leq N$, the image of $M'$ is $\phi(M')$ and the preimage of $N'$ is $\phi^{-1}(N')$
\end{itemize}
\end{Definition}

\subsection{Irreducible modules}
\begin{Definition}[irreducible, simple]
A $R$-module $N_R$ is irreducible (or simple) if $N\neq 0$ and the only submodules of $N$ are $N$ and $0$.
\end{Definition}
\begin{Definition}[Annihilator]
Suppose $N_R$ is irreducible then for all $x\in N-\{0\}$ there exists $R$-epimorphism $\pi_x: R\rightarrow N, r\mapsto x r $. 
$Ker(\pi_x)$ is the annihilator ($Ann(x):=\{r \in R : x r=0\}$) - it's a right ideal of $R$.
\end{Definition}

\begin{Lemma}
If $N_R$ is irreducible then $Ann(x)$ is a maximal right ideal.
Conversely if $m$ is a maximal right ideal of $R$ then $R/m$ is an irreducible right $R$-module.
\end{Lemma}
\begin{proof}
If $m$ is a right ideal of $R$ with
$Ann(x)\subsetneq J \subsetneq R$ then $m/Ann(x)$ is a nonzero proper submodule of $R/Ann(x)\cong N$ - contradicting $N$ irreducible.
\end{proof}
 
\subsection{Change of rings}
Let $f:R\rightarrow S$ be a ring hommorphism and $N_S$ be a right $S$-module. Then $N$ can be made into a right $R$-module via $n\cdot r=n\cdot f(r), n\in N, r\in R$.
Say $N$ is an $R$-module $f^{\#} N$ by restriction of scalars. 
\begin{Example}

\begin{itemize}
	\item $\RR \hookrightarrow \CCC$. Every complex vector space is a real vector space.
	\item When $f$ is the characteristic homomorphism $\xi : \ZZ\rightarrow S$, then $\xi^{\#}N=$ underlying abelian group $N$.
	\end{itemize}
\end{Example}

Write $\sigma=Ker[f:R\rightarrow S]$. Then $\sigma$ annihilates $f^{\#}N$, i.e $na=0$ for all $a\in \sigma$.
In the other direction for all right ideal $\sigma$ of $R$ and $M_R$ we have \mbox{$M\sigma:=\{m_1a_1+\ldots+m_ka_k : k\geq 1, m_i\in M, a_i\in \sigma\}$} is a submodule of $M$ and is $0$  precisely  when $\sigma$ annihilates $M$.

\begin{Lemma}
Let $\sigma$ be a twosided ideal of a ring $R$ and $M_R$ a right $R$-module.
\begin{itemize}
	\item If $M\sigma=0$, then $M$ can be regarded as right $R/\sigma$-module via $m\cdot (r+\sigma)=mr\in M$
	\item More generally $M/M\sigma$ can be regarded as a $R/\sigma$ module by the rule
	$(m+M\sigma)\cdot(r+\sigma)=mr+M\sigma$.
\end{itemize}
\end{Lemma}

\begin{Definition}[exact sequences]
A sequence of module homomorphisms is called exact if it is exact as a sequence of homomorphisms of abelian groups. 
\end{Definition}

\begin{Example}

\begin{itemize}
	\item $0\rightarrow \ZZ\rightarrow \ZZ\rightarrow \ZZ/n\ZZ\rightarrow 0$, $n>0$.
	\item $0\rightarrow \ZZ/2\ZZ \rightarrow \ZZ/4\ZZ \rightarrow \ZZ/2\ZZ\rightarrow 0$ does not split.
	\item $0\rightarrow \ZZ/2\ZZ\rightarrow \ZZ/2\ZZ \oplus \ZZ/2\ZZ \rightarrow \ZZ/2\ZZ\rightarrow 0$.
	\item $\ZZ$-module: $0\rightarrow \ZZ/2\ZZ\rightarrow \ZZ/6\ZZ\rightarrow \ZZ/3\ZZ \rightarrow 0$ is the 'same' as
	\mbox{$0\rightarrow \ZZ/2\ZZ\rightarrow \ZZ/2\ZZ \oplus \ZZ/3\ZZ\rightarrow \ZZ/3\ZZ\rightarrow 0$}.
	\item Field $F$, $F$-vector space $V$, $V$ finite dimensional with subspace $W$ gives a short exact sequence
	$0\rightarrow W\rightarrow V \rightarrow V/W\rightarrow 0$. Here there exists a complementary subspace $W'$ to $W$, i.e. $W\cap W'=0$, and $W+W'=V$
	Then say $V\cong W\oplus W'$ and $W'\cong V/W$ via $w'\mapsto w'+W$.
\end{itemize}

\end{Example}

 
\begin{Definition}[external direct sum]
Given $M'_R$ and $M''_R$ there exists a short exact sequence the standard split exact sequence called the external direct sum:
$$0\rightarrow M'\stackrel{\mu}\rightarrow M'\oplus M'' \stackrel{\epsilon}\rightarrow M''\rightarrow 0~~(*).$$ 

$M'\oplus M'':=\{(m',m'') : m'\in M', m''\in M''\}$
$\mu(m')=(m',0)$ and $\epsilon(m',m'')=m''$.
The rest of splittings and stuff is similar to groups and you get the standard set of inclusions/projections for $M'\oplus M''$.
\end{Definition}

\begin{Lemma}
The following are equivalent:

\begin{itemize}
	\item $(*)$ splits at $\mu$.
	\item $(*)$ splits at $\epsilon$.
	\item $\exists \sigma: M''\rightarrow M$ and $\pi:M \rightarrow M'$ with $\epsilon\sigma=id_{M''}$, $\pi\mu=id_{M'}$ and $\mu\pi+\sigma\epsilon=id_M$, i.e. $\mu, \epsilon, \pi, \sigma$ are a full set of inclusions and projections for $M$.
	\item $M\cong M'\oplus M''$ through $\mu+\epsilon$, i.e. there is an isomorphism $\phi: M\rightarrow M'\oplus M''$ with $\phi\mu(m')=(m',0)$ and $\epsilon \phi^{-1}(m',m'')=m''$ for all $m'\in M', m''\in M''$.
	
\end{itemize}

\end{Lemma}
\begin{Lemma}
For $i=1,2,$ let $M_i$ be a submodule of $M_R$ with inclusion \mbox{$\sigma_i: M_i\hookrightarrow M$}. The following are equivalent:

\begin{itemize}
	\item $M=M_1+M_2$ and $M_1\cap M_2=\{0\}$
	\item $\forall  m \in M \exists ! m_1\in M_1, m_2 \in M_2$ with $m=m_1+m_2$
	\item the pair $\sigma_1,\sigma_2$ extends to a full set of inclusions and projections $\{\sigma_1,\sigma_2,\pi_1,\pi_2\}$ of $M$.
\end{itemize}
The quintessence of this lemma is that the internal direct sum is 'the same' as the external direct sum.
\end{Lemma}

\begin{Definition}[decomposable]
Call $M$ decomposbale if there exists \mbox{$M=M_1\oplus M_2$} with $M_1\neq 0$ and $M_2\neq 0$. Note that $\oplus$ demands $M_1\cap M_2=\{0\}$

\end{Definition}

\subsection{Free and finitely generated modules}
A subset $A$ of $M_R$ generates $M$ if $M=AR;=\{\sum_{i=1}^na_ir_i |a_i\in A, r_i\in R, n\in \NN \}$
If there exists a finite generating set $A$ for $M$, say $M$ is finitely generated. If $|A|=1$ we call the module $M$ cyclic.

\begin{Definition}[$R$-independent]
A subset $A$ of $M_R$ is $R$-free or $R$-independent if the only relations of the form $a_1r_1+\ldots+a_kr_k=0$ and $a_i\neq a_j$ for $i\neq j$ are the trivial ones $r_1=\ldots =r_k=0$.
$\emptyset$ is regarded as free.
\end{Definition} 
\begin{Example}
$(\ZZ/m)_{\ZZ}$ contains no nonempty free subset $A$ as $am=0$ for all $a\in A$.
However $(\ZZ/m)_{\ZZ/m}$ contains free subset ${1}$ . This shows that the choice of the ring is very important.
\end{Example}

\begin{Definition}[torsion]
Let $a\in M$. If $\{a\}$ is not free, then there exists $r\in R-\{0\}$ with $ar=0$. Say $a$ has torsion or is a torsion element. Otherwise, call $a$ torsion-free; then $aR\cong R_R$ via $1\mapsto a, r\mapsto ar$. If every element of $M$ has torsion, $M$ is a torsion module. If no element of $M$ has torsion, $M$ is torsion-free.
\end{Definition}

\begin{Lemma}
If $R$ is a commutative domain, then the set of torsion elements of $M_R$ forms a submodule $T(M)$, and the quotient module $M_R/T(M)$ is torsion-free.
\end{Lemma}

\begin{Lemma}
For a subset $A$ of $M$. $A \stackrel{\mu}\hookrightarrow M_R$ the following are equivalent:

\begin{itemize}
	\item  $\forall$  right $R$-modules $N_R$, every set function $b: A\rightarrow N$ extends uniquely to $M$.
	\item $\mu$ induces a bijection between $$\{\text{set functions $b: A\rightarrow N_R$} \}\leftrightarrow \{\text{homomorphisms $\phi: M\rightarrow N_R$} \}$$
	\item $A$ is a $R$-free ($R$-independent) generating set for $M$ (say $M$ is free on $A$).
\end{itemize}
\universal{A}{M}{N_R}{b}{\mu}{\exists ! \phi}
\end{Lemma}
An ordered free generating set is a basis (not necessarily finite). Then every $m\in M$ can be written uniquely in the form $m=\sum_{a\in A}'ar_a(m)$ with each $r_a(m)\in R$ unique, almost all 0.
Then there exists a full set of inclusions \mbox{$\sigma_a: aR \hookrightarrow M$} ($aR$ is a cyclic submodule)
and projections $\pi_a :M\twoheadrightarrow aR, m\mapsto ar_a(m)$. $M=\bigoplus_{a\in A}aR \cong \bigoplus_{a\in A}R_R$. When $A$ is an ordered set we write $R^A$.
For $n\in \NN$, there exists the standard free module $R^n=R_R\oplus\ldots\oplus R_R$ of $n$-tuples of elements of $R$. It is freely generated by $e_1,\ldots,e_n$. So $m=(r_1,\ldots r_n)\in R^n$ has $r_{e_i}(m)=r_i$

\begin{Lemma}

\begin{itemize}
	\item $M$ has a generating set with less than $n$ elements iff $M$ is a homomorphic image of $R^n$.
	\item $M$ has a free generating set of $n$ elements iff $M\cong R^n$.
\end{itemize}
In the second part $n$ need not be unique. In other words it is possible to have $R^n\cong R^k$ with $n\neq k$.
If $R^n=R^k$ implies $n=k$ we say $R$ has invariant basis number (IBN). Call this $n$ the rank of $R^n$.
Any commutative ring has a IBN.
\end{Lemma}
We will prove a weaker theorem talking about commutative domains.
\begin{Theorem}
Every commutative domain $R$ has IBN.
\end{Theorem}
\begin{Proof}
Embed $R$ into its field of fractions $K$. Suppose there exists an isomorphism \mbox{$\phi: R^n \rightarrow R^k$}. To show $n=k$, it suffices to show that $\phi$ induces an isomorphism \mbox{$K^n \rightarrow K^k$} since the dimension of a finite dimensional vector space is unique.
After simplifying denominators, any element of $K^n$ has the form $(\sum_{i=1}^n e_i r_i) s^{-1}$. $\phi$ extends to $\Phi: K^n\rightarrow K^k$ via
$(\sum e_i r_i )s^{-1}\mapsto (\sum \phi(e_i)r_i)s^{-1}$. If $\phi$ is an isomorphism, $\Phi$ will be an isomorphism.
\end{Proof}

\begin{Lemma}
Any epimorphism $\epsilon: M \twoheadrightarrow R^{\Lambda}$ onto a free module is split, and so $M\cong R^\Lambda Ker (\epsilon)$. (am I missing a $\oplus$ in here?)
\end{Lemma}

\begin{Lemma}
In a PID, every nonzero ideal is a free module of rank 1.
\end{Lemma}

\begin{Proof}
Every ideal is principal, say $aR$ ($a\neq 0)$. As $R$ is a domain there are no zero divisors and thus the epimorphism $R\rightarrow aR, r \mapsto ar$ is also a monomorphism. Thus $aR\cong R$ 
\end{Proof}

\subsection{Projective modules}
The following Theorem contains the definition of a projective module.
\begin{Theorem}
Let $P$ be a right $R$-module. 

\begin{itemize}
	\item The following are equivalent:
\begin{enumerate}[i)]
	\item commuting diagram    $M\stackrel{\beta}\twoheadrightarrow M''$, $P \stackrel{\alpha}\rightarrow M''$. There exists a lift (not necessarily unique) $\phi: P\rightarrow M$ with $\alpha=\beta \phi$.

	$$\xymatrix{P \ar@{.>}[dr]_{ \exists \phi } \ar[r]^{ \alpha } & M'' \\
&  M\ar@{->>}[u]_{ \beta}}$$


	\item $\beta : M \twoheadrightarrow M''$ implies $\beta_*: Hom(P_R,M_R)\twoheadrightarrow Hom(P_r,M''_R), \phi\mapsto \beta \circ \phi$.
	\item $\pi: M\twoheadrightarrow P$ implies $\pi$ splits.
	\item $\pi:M \twoheadrightarrow P$ implies $M\cong P\oplus Ker \pi$.
	\item $\exists R ^{\Lambda}, Q_R$ with $R^{\Lambda}\cong P\oplus Q$. (means: There exists a module $Q$ such that $P\oplus Q$ is free)
\end{enumerate}
\item If $P$ is finitely generated. Then (i)-(v) are equivalent to

\begin{enumerate}[vi)]
	\item $\exists n, Q_R$ with $R^n \cong P\oplus Q$.
	\item $\exists n$ and an idempotent $\epsilon$ (projection) with $P\cong  \epsilon(R^n)$.
\end{enumerate}

\end{itemize}
Call $P$ satisfying these conditions projective.
\end{Theorem}

\begin{Proof}

\begin{itemize}
	\item $(i)\Rightarrow (ii) \Rightarrow (iii) \Rightarrow (iv) \Rightarrow (v)$ and 
$(iv)\Rightarrow(v)$ and $(vi) \Rightarrow (vii)$ are straightforward.
\item For $(vii)\Rightarrow (vi)$: to show that $P\cong \epsilon(R^n)\hookrightarrow R^n$ splits, write $v\in \epsilon(R^n)$ as $v=\epsilon(u)$, $u\in R^n$.
\item For $(v)\Rightarrow(i)$:  use $R^{\Lambda}\cong P\oplus Q$ to expand $P\stackrel{\alpha}{\rightarrow}M''$ to $R^{\Lambda}.$
\end{itemize}
\end{Proof}

Now we will introduce a construction that is needed to complete the above proof as done in the exercise.

\begin{Lemma}
Given right $R$-module homomorphisms $M_1\stackrel{\alpha_1}\rightarrow L$ and $M_2\stackrel{\alpha_2}\rightarrow L$. There exsists a right $R$-module, the pullback or fibre product 
$$M_1\times_L M_2:=\{(m_1,m_2)\in M_1\oplus M_2 | \alpha_1(m_1)=\alpha_2(m_2)\}$$ with the universal property that for any $R$-module with homomorphisms $u_1: H\rightarrow M_1$ and $u_2: H\rightarrow M_2$ with $\alpha_1 \circ u_1=\alpha_2 \circ u_2$ there exists \mbox{$\gamma : H\rightarrow M_1\times_L M_2$} with $\alpha'_i \circ \gamma=u_i$.
$$
\xymatrix{
H \ar@/_/[ddr]_{u_1} \ar@/^/[drr]^{u_2} \ar@{.>}[dr]^{\gamma}& &\\
& M_1\times_L M_2 \ar[d]_{\alpha'_1} \ar[r]^{\alpha'_2}   & M_2  \ar[d]_{\alpha_2} \\
& M_1  \ar[r]_{\alpha_1} & L
}
$$
 
With this device you can show $(v)$ implies $(i)$ in the previous Theorem.
\end{Lemma}

From condition v) we can see that any free module is projective.

\includepdf[pages={1-17}]{11MA5203_Lectures14-16.pdf}